// 引入koa-router
const Router = require('koa-router')
const {categorizeValid} = require('../../middleware/valid')
// 引入处理函数层
const {getCategorizes, addCategorize, delcategorize, editCategorize} = require('../../controller/categorizes.controller')
// 创建实例
// prefix在路由地址前缀加上默认地址
const router = new Router({ prefix:'/api/categorizes' })
// 1.获取所有分类
router.post('/getcategorizes', getCategorizes )
// 2.添加分类
router.post('/addcategorize', addCategorize )
// 3.删除分类（恢复分类）
router.post('/delcategorize', categorizeValid, delcategorize )
// 4.修改分类
router.post('/editcategorize', categorizeValid, editCategorize )
module.exports = router